package com.example.medicalequipment.database;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.medicalequipment.entity.MedicalDevice;

import java.util.List;

@Dao
public interface MedicalDeviceDao {
    @Insert
    long insertDevice(MedicalDevice device);

    @Update
    void updateDevice(MedicalDevice device);

    @Query("SELECT * FROM medical_device ORDER BY reportTime DESC")
    List<MedicalDevice> getAllDevices();

    @Query("SELECT * FROM medical_device WHERE id = :deviceId")
    MedicalDevice getDeviceById(int deviceId);

    @Query("SELECT * FROM medical_device WHERE status = :status ORDER BY reportTime DESC")
    List<MedicalDevice> getDevicesByStatus(int status);
}
